package com.yanqu.road.entity.activity.suitang.config;

import com.yanqu.road.entity.FieldTypeAnnotation;
import com.yanqu.road.utils.string.StringUtils;

import java.util.List;

@FieldTypeAnnotation(tableName = "t_s_activity_suitang_type")
public class SuiTangCityTypeConfig {

    @FieldTypeAnnotation(desc = "活动ID", select = true)
    private int activityId;
    @FieldTypeAnnotation(desc = "战场类型", update = true)
    private int warType;
    @FieldTypeAnnotation(desc = "城池类型", update = true)
    private int type;
    @FieldTypeAnnotation(desc = "城池图标")
    private int icon;
    @FieldTypeAnnotation(desc = "城池类型名称")
    private String name = "";
    @FieldTypeAnnotation(desc = "势力(第1天|第2天|第3天)")
    private String campPoint = "";
    @FieldTypeAnnotation(desc = "军资产量/h")
    private long foodProduction;
    @FieldTypeAnnotation(desc = "防守加成(千分比)")
    private int addition;
    @FieldTypeAnnotation(desc = "buff效果")
    private String buffEffect = ""; // 就是buff ID，0表示没有
    @FieldTypeAnnotation(desc = "保护时间/h(这个时间段内不能被攻打)")
    private String protectTime = "";
    @FieldTypeAnnotation(desc = "守军人数上限")
    private int defenseMax;
    @FieldTypeAnnotation(desc = "攻城人数上限")
    private int attack;
    @FieldTypeAnnotation(desc = "守军队伍数量(第1天|第2天|第3天)")
    private String teamNum = "";
    @FieldTypeAnnotation(desc = "每个守军队伍人数(第1天|第2天|第3天)")
    private String soldierNum = "";
    @FieldTypeAnnotation(desc = "将军队伍数量(第1天|第2天|第3天)")
    private String generalTeamNum = "";
    @FieldTypeAnnotation(desc = "每个将军队伍人数(第1天|第2天|第3天)")
    private String generalSoldierNum = "";
    @FieldTypeAnnotation(desc = "被攻击后首次恢复队伍数量(第1天|第2天|第3天)")
    private String firstRecoverTeamNum = "";
    @FieldTypeAnnotation(desc = "被攻击后恢复队伍数量(第1天|第2天|第3天)")
    private String recoverTeamNum = "";

    public int getActivityId() {
        return activityId;
    }

    public void setActivityId(int activityId) {
        this.activityId = activityId;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public int getIcon() {
        return icon;
    }

    public void setIcon(int icon) {
        this.icon = icon;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public long getFoodProduction() {
        return foodProduction;
    }

    public void setFoodProduction(long foodProduction) {
        this.foodProduction = foodProduction;
    }

    public int getTeamNum(int round) {
        int index = round - 1;
        List<Integer> integers = StringUtils.stringToIntegerList(teamNum, "\\|");
        if (integers.size() <= index || index < 0) {
            return 0;
        }
        return integers.get(index);
    }
    public String getTeamNum() {
        return teamNum;
    }

    public String getSoldierNum() {
        return soldierNum;
    }

    public String getGeneralTeamNum() {
        return generalTeamNum;
    }

    public String getGeneralSoldierNum() {
        return generalSoldierNum;
    }

    public void setTeamNum(String teamNum) {
        this.teamNum = teamNum;
    }

    public int getSoldierNum(int round) {
        int index = round - 1;
        List<Integer> integers = StringUtils.stringToIntegerList(soldierNum, "\\|");
        if (integers.size() <= index || index < 0) {
            return 0;
        }
        return integers.get(index);
    }

    public void setSoldierNum(String soldierNum) {
        this.soldierNum = soldierNum;
    }

    public int getAddition() {
        return addition;
    }

    public void setAddition(int addition) {
        this.addition = addition;
    }

    public int getBuffEffectTemp() {
        return StringUtils.parseInt(buffEffect);
    }

    public String getBuffEffect() {
        return buffEffect;
    }

    public void setBuffEffect(String buffEffect) {
        this.buffEffect = buffEffect;
    }

    public int getCampPoint(int round) {
        List<Integer> list = StringUtils.stringToIntegerList(campPoint, "\\|");
        if (list.size() <= round) {
            return 0;
        }
        return list.get(round);
    }

    public String getCampPoint() {
        return campPoint;
    }

    public void setCampPoint(String  campPoint) {
        this.campPoint = campPoint;
    }

    public int getWarType() {
        return warType;
    }

    public void setWarType(int warType) {
        this.warType = warType;
    }

    public String getProtectTime() {
        return protectTime;
    }

    public void setProtectTime(String protectTime) {
        this.protectTime = protectTime;
    }

    public int getDefenseMax() {
        return defenseMax;
    }

    public void setDefenseMax(int defenseMax) {
        this.defenseMax = defenseMax;
    }

    public int getAttack() {
        return attack;
    }

    public void setAttack(int attack) {
        this.attack = attack;
    }

    public int getGeneralTeamNum(int round) {
        int index = round - 1;
        List<Integer> integers = StringUtils.stringToIntegerList(generalTeamNum, "\\|");
        if (integers.size() <= index || index < 0) {
            return 0;
        }
        return integers.get(index);
    }

    public void setGeneralTeamNum(String generalTeamNum) {
        this.generalTeamNum = generalTeamNum;
    }

    public int getGeneralSoldierNum(int round) {
        int index = round - 1;
        List<Integer> integers = StringUtils.stringToIntegerList(generalSoldierNum, "\\|");
        if (integers.size() <= index || index < 0) {
            return 0;
        }
        return integers.get(index);
    }

    public void setGeneralSoldierNum(String generalSoldierNum) {
        this.generalSoldierNum = generalSoldierNum;
    }

    public String getFirstRecoverTeamNum() {
        return firstRecoverTeamNum;
    }

    public int getFirstRecoverTeamNum(int round) {
        int index = round - 1;
        List<Integer> list = StringUtils.stringToIntegerList(firstRecoverTeamNum, "\\|");
        if (list.size() <= index || index < 0) {
            return 0;
        }
        return list.get(index);
    }

    public void setFirstRecoverTeamNum(String firstRecoverTeamNum) {
        this.firstRecoverTeamNum = firstRecoverTeamNum;
    }

    public int getRecoverTeamNum(int round) {
        int index = round - 1;
        List<Integer> list = StringUtils.stringToIntegerList(recoverTeamNum, "\\|");
        if (list.size() <= index || index < 0) {
            return 0;
        }
        return list.get(index);
    }

    public String getRecoverTeamNum() {
        return recoverTeamNum;
    }

    public void setRecoverTeamNum(String recoverTeamNum) {
        this.recoverTeamNum = recoverTeamNum;
    }

    public boolean InitParamConfig() {
        return true;
    }
}
